package com.strelitzia.config;


import com.strelitzia.constant.RootPath;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author DONG
 * @create 2023/10/26 13:02
 */
@Configuration
public class ResourceConfig implements WebMvcConfigurer {
    /**
     * 文件资源处理
     **/
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //addResourceLocations:存放文件资源的路径
        //addResourceHandler:映射后的访问路径
        registry.addResourceHandler("/res/**").addResourceLocations("file:" + RootPath.ROOT_PATH);
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }
}
